package oop.ex1.filters;
import java.text.*;
import java.util.Date;
/**
 * an abstract class that all the date dependent filter inherits from
 * @author danalmog
 * @author danielshalev
 */
public abstract class DateDependent extends Filters {
	// a date format
	private final SimpleDateFormat FORM = new SimpleDateFormat("dd/MM/yyyy");
	//the date
	protected Date date;
	
	protected boolean hasNot;
	
	/**
	 * constructor for DateDependent class
	 * @param date the date to form
	 * @param hasNot indicates if the filter is a NOT filter
	 * @throws FilterDateExeption indicates that there is a problem with the date
	 */
	public DateDependent(String date, boolean hasNot) throws FilterDateExeption{
		try{
			this.date=FORM.parse(date);
			this.hasNot=hasNot;
		}
		catch (ParseException pe) {
			throw new FilterDateExeption(pe.getMessage(), pe.getErrorOffset());
		}
	}
	/**
	 * getter for dateDependent classes
	 * @return the date
	 */
	protected Date getDate(){
		return date;
	}
}
